<template>
  <!-- 项目的最外层 -->
  <div class="outer">
    <!-- 商品分类导航 -->
    <TypeNav :is-show-sort.sync="isShowSort"></TypeNav>
    <!-- 主要内容区域 -->
    <section class="con">
      <!-- 导航路径区域 -->
      <div class="conPoin">
        <div class="conPoin">
          <a v-show="categoryView.category1Name">{{
            categoryView.category1Name
          }}</a>
          <a v-show="categoryView.category2Name">{{
            categoryView.category2Name
          }}</a>
          <a v-show="categoryView.category3Name">{{
            categoryView.category3Name
          }}</a>
        </div>
      </div>
      <!-- 主要内容区域 -->
      <div class="mainCon">
        <ImgZoom></ImgZoom>
        <!-- 右侧选择区域布局 -->
        <ShopAttr :shop-id="shopId"></ShopAttr>
      </div>
    </section>

    <!-- 内容详情页 -->
    <section class="productDetail">
      <aside class="aside">
        <div class="tabWraped">
          <h4 class="active">相关分类</h4>
          <h4>推荐品牌</h4>
        </div>
        <div class="tabContent">
          <div class="tab-pane active">
            <ul class="partList">
              <li>手机</li>
              <li>手机壳</li>
              <li>内存卡</li>
              <li>Iphone配件</li>
              <li>贴膜</li>
              <li>手机耳机</li>
              <li>移动电源</li>
              <li>平板电脑</li>
            </ul>
            <ul class="goodsList">
              <li>
                <div class="list-wrap">
                  <div class="p-img">
                    <img src="~assets/images/detail/part01.png" />
                  </div>
                  <div class="attr">Apple苹果iPhone 6s (A1699)</div>
                  <div class="price">
                    <em>¥</em>
                    <i>6088.00</i>
                  </div>
                  <div class="operate">
                    <a href="javascript:void(0);">加入购物车</a>
                  </div>
                </div>
              </li>
              <li>
                <div class="list-wrap">
                  <div class="p-img">
                    <img src="~assets/images/detail/part02.png" />
                  </div>
                  <div class="attr">
                    <em>Apple苹果iPhone 6s (A1699)</em>
                  </div>
                  <div class="price">
                    <strong>
                      <em>¥</em>
                      <i>6088.00</i>
                    </strong>
                  </div>
                  <div class="operate">
                    <a href="javascript:void(0);">加入购物车</a>
                  </div>
                </div>
              </li>
              <li>
                <div class="list-wrap">
                  <div class="p-img">
                    <img src="~assets/images/detail/part03.png" />
                  </div>
                  <div class="attr">
                    <em>Apple苹果iPhone 6s (A1699)</em>
                  </div>
                  <div class="price">
                    <strong>
                      <em>¥</em>
                      <i>6088.00</i>
                    </strong>
                  </div>
                  <div class="operate">
                    <a href="javascript:void(0);">加入购物车</a>
                  </div>
                </div>
              </li>
              <li>
                <div class="list-wrap">
                  <div class="p-img">
                    <img src="~assets/images/detail/part02.png" />
                  </div>
                  <div class="attr">
                    <em>Apple苹果iPhone 6s (A1699)</em>
                  </div>
                  <div class="price">
                    <strong>
                      <em>¥</em>
                      <i>6088.00</i>
                    </strong>
                  </div>
                  <div class="operate">
                    <a href="javascript:void(0);">加入购物车</a>
                  </div>
                </div>
              </li>
              <li>
                <div class="list-wrap">
                  <div class="p-img">
                    <img src="~assets/images/detail/part03.png" />
                  </div>
                  <div class="attr">
                    <em>Apple苹果iPhone 6s (A1699)</em>
                  </div>
                  <div class="price">
                    <strong>
                      <em>¥</em>
                      <i>6088.00</i>
                    </strong>
                  </div>
                  <div class="operate">
                    <a href="javascript:void(0);">加入购物车</a>
                  </div>
                </div>
              </li>
            </ul>
          </div>
          <div class="tab-pane">
            <p>推荐品牌</p>
          </div>
        </div>
      </aside>
      <div class="detail">
        <div class="fitting">
          <h4 class="kt">选择搭配</h4>
          <div class="good-suits">
            <div class="master">
              <img src="~assets/images/detail/l-m01.png" />
              <p>￥{{ goodsInfo.price }}</p>
              <i>+</i>
            </div>
            <ul class="suits">
              <li class="suitsItem">
                <img src="~assets/images/detail/dp01.png" />
                <p>Feless费勒斯VR</p>
                <label>
                  <input type="checkbox" value="39" />
                  <span>39</span>
                </label>
              </li>
              <li class="suitsItem">
                <img src="~assets/images/detail/dp02.png" />
                <p>Feless费勒斯VR</p>
                <label>
                  <input type="checkbox" value="50" />
                  <span>50</span>
                </label>
              </li>
              <li class="suitsItem">
                <img src="~assets/images/detail/dp03.png" />
                <p>Feless费勒斯VR</p>
                <label>
                  <input type="checkbox" value="59" />
                  <span>59</span>
                </label>
              </li>
              <li class="suitsItem">
                <img src="~assets/images/detail/dp04.png" />
                <p>Feless费勒斯VR</p>
                <label>
                  <input type="checkbox" value="99" />
                  <span>99</span>
                </label>
              </li>
            </ul>
            <div class="result">
              <div class="num">已选购0件商品</div>
              <div class="price-tit">套餐价</div>
              <div class="price">
                ￥{{ goodsInfo.price }}/div>
                <button class="addshopcar">加入购物车</button>
              </div>
            </div>
          </div>
          <div class="intro">
            <ul class="tab-wraped">
              <li class="active">
                <a href="###"> 商品介绍 </a>
              </li>
              <li>
                <a href="###"> 规格与包装 </a>
              </li>
              <li>
                <a href="###"> 售后保障 </a>
              </li>
              <li>
                <a href="###"> 商品评价 </a>
              </li>
              <li>
                <a href="###"> 手机社区 </a>
              </li>
            </ul>
            <div class="tab-content">
              <div id="one" class="tab-pane active">
                <ul class="goods-intro">
                  <li>分辨率：1920*1080(FHD)</li>
                  <li>后置摄像头：1200万像素</li>
                  <li>前置摄像头：500万像素</li>
                  <li>核 数：其他</li>
                  <li>频 率：以官网信息为准</li>
                  <li>品牌： Apple</li>
                  <li>商品名称：APPLEiPhone 6s Plus</li>
                  <li>商品编号：1861098</li>
                  <li>商品毛重：0.51kg</li>
                  <li>商品产地：中国大陆</li>
                  <li>热点：指纹识别，Apple Pay，金属机身，拍照神器</li>
                  <li>系统：苹果（IOS）</li>
                  <li>像素：1000-1600万</li>
                  <li>机身内存：64GB</li>
                </ul>
                <div class="intro-detail">
                  <img src="~assets/images/detail/intro01.png" />
                  <img src="~assets/images/detail/intro02.png" />
                  <img src="~assets/images/detail/intro03.png" />
                </div>
              </div>
              <div id="two" class="tab-pane">
                <p>规格与包装</p>
              </div>
              <div id="three" class="tab-pane">
                <p>售后保障</p>
              </div>
              <div id="four" class="tab-pane">
                <p>商品评价</p>
              </div>
              <div id="five" class="tab-pane">
                <p>手机社区</p>
              </div>
            </div>
          </div>
        </div>
      </div>
    </section>

    <!-- 猜你喜欢 -->
    <div class="like">
      <h4 class="kt">猜你喜欢</h4>
      <ul class="like-list">
        <li class="likeItem">
          <div class="p-img">
            <img src="~assets/images/detail/itemlike01.png" />
          </div>
          <div class="attr">
            <em>DELL戴尔Ins 15MR-7528SS 15英寸 银色 笔记本</em>
          </div>
          <div class="price">
            <em>¥</em>
            <i>3699.00</i>
          </div>
          <div class="commit">已有6人评价</div>
        </li>
        <li class="likeItem">
          <div class="p-img">
            <img src="~assets/images/detail/itemlike02.png" />
          </div>
          <div class="attr">Apple苹果iPhone 6s/6s Plus 16G 64G 128G</div>
          <div class="price">
            <em>¥</em>
            <i>4388.00</i>
          </div>
          <div class="commit">已有700人评价</div>
        </li>
        <li class="likeItem">
          <div class="p-img">
            <img src="~assets/images/detail/itemlike03.png" />
          </div>
          <div class="attr">DELL戴尔Ins 15MR-7528SS 15英寸 银色 笔记本</div>
          <div class="price">
            <em>¥</em>
            <i>4088.00</i>
          </div>
          <div class="commit">已有700人评价</div>
        </li>
        <li class="likeItem">
          <div class="p-img">
            <img src="~assets/images/detail/itemlike04.png" />
          </div>
          <div class="attr">DELL戴尔Ins 15MR-7528SS 15英寸 银色 笔记本</div>
          <div class="price">
            <em>¥</em>
            <i>4088.00</i>
          </div>
          <div class="commit">已有700人评价</div>
        </li>
        <li class="likeItem">
          <div class="p-img">
            <img src="~assets/images/detail/itemlike05.png" />
          </div>
          <div class="attr">DELL戴尔Ins 15MR-7528SS 15英寸 银色 笔记本</div>
          <div class="price">
            <em>¥</em>
            <i>4088.00</i>
          </div>
          <div class="commit">已有700人评价</div>
        </li>
        <li class="likeItem">
          <div class="p-img">
            <img src="~assets/images/detail/itemlike06.png" />
          </div>
          <div class="attr">DELL戴尔Ins 15MR-7528SS 15英寸 银色 笔记本</div>
          <div class="price">
            <em>¥</em>
            <i>4088.00</i>
          </div>
          <div class="commit">已有700人评价</div>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
// 公共组件
import TypeNav from 'components/common/TypeNav'
// 子组件
import ImgZoom from './detailChild/ImgZoom.vue'
import ShopAttr from './detailChild/ShopAttr.vue'
// vuex辅助函数
import { mapActions, mapGetters, mapState } from 'vuex'
export default {
  name: 'Detail',
  data () {
    return {
      isShowSort: false
    }
  },
  props: {
    shopId: {
      type: [Number, String]
    }
  },
  components: {
    TypeNav,
    ImgZoom,
    ShopAttr
  },

  computed: {
    ...mapState('detail', ['goodsInfo']),
    ...mapGetters('detail', [
      'skuInfo',
      'categoryView',
      'skuImageList',
      'shopAttr'
    ])
  },
  watch: {},
  created () {},
  mounted () {
    // 派发aciotn获取商品数据
    this.onGetGoodsInfo(this.shopId)
  },
  methods: {
    ...mapActions('detail', ['onGetGoodsInfo'])
  }
}
</script>

<style lang="less">
.outer {
  .con {
    width: 1200px;
    margin: 15px auto 0;
    .conPoin {
      padding: 9px 15px 9px 0;
      & > a + a:before {
        content: '/\00a0';
        padding: 0 5px;
        color: #ccc;
      }
    }
    .mainCon {
      overflow: hidden;
      margin: 5px 0 15px;
    }
  }
  .productDetail {
    width: 1200px;
    margin: 30px auto 0;
    overflow: hidden;
    .aside {
      width: 210px;
      float: left;
      border: 1px solid #ccc;
      .tabWraped {
        height: 40px;
        h4 {
          border-top: 3px solid #fff;
          float: left;
          line-height: 37px;
          width: 105px;
          text-align: center;
          border-bottom: 1px solid #ccc;
          &.active {
            border-top: 3px solid #e1251b;
            border-bottom: 0;
            font-weight: normal;
          }
        }
      }
      .tabContent {
        padding: 10px;
        .tab-pane {
          display: none;
          &.active {
            display: block;
          }
          &:nth-child(1) {
            .partList {
              overflow: hidden;
              li {
                width: 50%;
                float: left;
                border-bottom: 1px dashed #ededed;
                line-height: 28px;
              }
            }
            .goodsList {
              & > li {
                margin: 5px 0 15px;
                border-bottom: 1px solid #ededed;
                padding-bottom: 5px;
                .list-wrap {
                  .p-img {
                    text-align: center;
                    img {
                      width: 152px;
                    }
                  }
                  .price {
                    font-size: 16px;
                    color: #c81623;
                  }
                  .operate {
                    text-align: center;
                    margin: 5px 0;
                    a {
                      background-color: transparent;
                      border: 1px solid #8c8c8c;
                      color: #8c8c8c;
                      display: inline-block;
                      padding: 2px 14px;
                      line-height: 18px;
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
    .detail {
      width: 980px;
      float: right;
      .fitting {
        border: 1px solid #ddd;
        margin-bottom: 15px;
        .kt {
          border-bottom: 1px solid #ddd;
          background: #f1f1f1;
          color: #333;
          padding: 5px 0 5px 15px;
        }
        .good-suits {
          height: 170px;
          padding-top: 10px;
          .master {
            width: 127px;
            height: 165px;
            text-align: center;
            position: relative;
            float: left;
            img {
              width: 87px;
            }
            p {
              color: #c81623;
              font-size: 16px;
              font-weight: 700;
            }
            i {
              position: absolute;
              top: 48px;
              right: -25px;
              font-size: 16px;
            }
          }
          .suits {
            width: 668px;
            height: 165px;
            float: left;
            .suitsItem {
              float: left;
              width: 127px;
              padding: 0 20px;
              text-align: center;
              img {
                width: 120px;
                height: 130px;
              }
              p {
                font-size: 12px;
              }
              label {
                display: block;
                position: relative;
                input {
                  vertical-align: middle;
                }
                span {
                  vertical-align: middle;
                }
              }
            }
          }
          .result {
            border-left: 1px solid #ddd;
            width: 153px;
            height: 165px;
            padding-left: 20px;
            float: left;
            .num {
              font-size: 14px;
              margin-bottom: 10px;
              margin-top: 10px;
            }
            .price-tit {
              font-weight: bold;
              margin-bottom: 10px;
            }
            .price {
              color: #b1191a;
              font-size: 16px;
              margin-bottom: 10px;
            }
            .addshopcar {
              background-color: #e1251b;
              border: 1px solid #e1251b;
              padding: 10px 25px;
              font-size: 16px;
              color: #fff;
              display: inline-block;
              box-sizing: border-box;
            }
          }
        }
      }
      .intro {
        .tab-wraped {
          background: #ededed;
          // border: 1px solid #ddd;
          overflow: hidden;
          li {
            float: left;
            & + li > a {
              border-left: 1px solid #ddd;
            }
            &.active {
              a {
                // border: 0;
                background: #e1251b;
                color: #fff;
              }
            }
            a {
              display: block;
              height: 40px;
              line-height: 40px;
              padding: 0 11px;
              text-align: center;
              color: #666;
              background: #fcfcfc;
              border-top: 1px solid #ddd;
              border-bottom: 1px solid #ddd;
            }
          }
        }
        .tab-content {
          .tab-pane {
            display: none;
            &.active {
              display: block;
            }
            &:nth-child(1) {
              .goods-intro {
                padding-left: 10px;
                li {
                  margin: 10px 0;
                }
              }
              .intro-detail {
                img {
                  width: 100%;
                }
              }
            }
          }
        }
      }
    }
  }
  .like {
    width: 1198px;
    border: 1px solid #ddd;
    margin: 15px auto;
    .kt {
      border-bottom: 1px solid #ddd;
      background: #f1f1f1;
      color: #333;
      margin: 0;
      padding: 5px 10px;
    }
    .like-list {
      padding: 15px 11px;
      overflow: hidden;
      .likeItem {
        width: 196px;
        float: left;
        .p-img {
          text-align: center;
          img {
            width: 167px;
            height: 123px;
          }
        }
        .attr {
          padding: 0 15px;
        }
        .price {
          padding: 0 15px;
          font-size: 16px;
          color: #c81623;
          margin-bottom: 20px;
        }
        .commit {
          padding: 0 15px;
        }
      }
    }
  }
}
.outer {
  .toolbar {
    position: fixed;
    z-index: 999;
    width: 300px;
    height: 100%;
    background-color: #7a6e6e;
    transition: right 0.3s ease-in-out 0s;
    &.toolbar-out {
      top: 0px;
      right: 0px;
    }
    &.toolbar-wrap {
      top: 0px;
      right: -294px;
    }
    .content {
      position: relative;
      left: 6px;
      width: 294px;
      background-color: bisque;
      height: 100%;
      z-index: 99;
    }
    .but {
      position: relative;
      width: 35px;
      height: 35px;
      line-height: 35px;
      text-align: center;
      margin-bottom: 1px;
      cursor: pointer;
      background-color: #7a6e6e;
      border-radius: 3px 0 0 3px;
      position: absolute;
      top: 0;
      /*right: -6px;*/
      left: -29px;
      &.list {
        background-image: url(~assets/images/detail/list.png);
        background-repeat: no-repeat;
        background-size: cover;
      }
      &.pull-wrap {
        background-image: url(~assets/images/detail/cross.png);
        background-repeat: no-repeat;
        background-size: cover;
      }
    }
    .toolist {
      position: absolute;
      top: 50%;
      left: -29px;
      width: 35px;
      margin-top: -80px;
      /*background-color: cadetblue;*/
      .pull {
        position: relative;
        width: 35px;
        height: 35px;
        line-height: 35px;
        text-align: center;
        margin-bottom: 1px;
        cursor: pointer;
        background-color: #7a6e6e;
        border-radius: 3px 0 0 3px;
        z-index: 66;
        .vip {
          background-image: url(~assets/images/detail/toolbars.png);
          background-position: -88px -175px;
        }
        .cart {
          background-image: url(~assets/images/detail/toolbars.png);
          background-position: -50px 0;
        }
        .follow {
          background-image: url(~assets/images/detail/toolbars.png);
          background-position: -50px -50px;
        }
        .history {
          background-image: url(~assets/images/detail/toolbars.png);
          background-position: -50px -100px;
        }
        .message {
          background-image: url(~assets/images/detail/toolbars.png);
          background-position: -190px -150px;
        }
        .jimi {
          background-image: url(~assets/images/detail/toolbars.png);
          background-position: -50px -150px;
        }
        .top {
          background-image: url(~assets/images/detail/toolbars.png);
          background-position: -50px -250px;
        }

        .tab-text {
          width: 62px;
          height: 35px;
          line-height: 35px;
          color: #fff;
          text-align: center;
          font-family: 微软雅黑;
          position: absolute;
          /*position: relative;*/
          z-index: 1;
          left: 35px;
          top: 0;
          background-color: #7a6e6e;
          border-radius: 3px 0 0 3px;
          font-style: normal;
          -webkit-transition: left 0.3s ease-in-out 0.1s;
          transition: left 0.3s ease-in-out 0.1s;
        }
        .tab-ico {
          display: inline-block;
          position: relative;
          /*background-image: url(img/toolbars.png);*/
          background-color: #7a6e6e;
          border-radius: 3px 0 0 3px;
          z-index: 2;
          width: 35px;
          height: 35px;
        }
      }
    }

    & > .pull {
      position: relative;
      width: 35px;
      height: 35px;
      line-height: 35px;
      text-align: center;
      margin-bottom: 1px;
      cursor: pointer;
      background-color: #7a6e6e;
      border-radius: 3px 0 0 3px;
      z-index: 66;
      .tab-ico {
        display: inline-block;
        position: relative;
        /*background-image: url(img/toolbars.png);*/
        background-color: #7a6e6e;
        border-radius: 3px 0 0 3px;
        z-index: 2;
        width: 35px;
        height: 35px;
      }
      .top {
        background-image: url(~assets/images/detail/toolbars.png);
        background-position: -50px -250px;
      }

      .tab-text {
        width: 62px;
        height: 35px;
        line-height: 35px;
        color: #fff;
        text-align: center;
        font-family: 微软雅黑;
        position: absolute;
        /*position: relative;*/
        z-index: 1;
        left: 35px;
        top: 0;
        background-color: #7a6e6e;
        border-radius: 3px 0 0 3px;
        font-style: normal;
        -webkit-transition: left 0.3s ease-in-out 0.1s;
        transition: left 0.3s ease-in-out 0.1s;
      }
    }
    & > .back {
      position: absolute;
      bottom: 0;
      /*right: -6px;*/
      left: -29px;
      display: inline-block;
      background-image: url(~assets/images/detail/toolbars.png);
    }
  }
  .header {
    & > .top {
      background-color: #eaeaea;
      height: 30px;
      line-height: 30px;
      .container {
        width: 1200px;
        margin: 0 auto;
        overflow: hidden;
        .loginList {
          float: left;
          p {
            float: left;
            margin-right: 10px;
            .register {
              border-left: 1px solid #b3aeae;
              padding: 0 5px;
              margin-left: 5px;
            }
          }
        }
        .typeList {
          float: right;
          a {
            padding: 0 10px;
            & + a {
              border-left: 1px solid #b3aeae;
            }
          }
        }
      }
    }
    & > .bottom {
      width: 1200px;
      margin: 0 auto;
      overflow: hidden;
      .logoArea {
        float: left;
        .logo {
          img {
            width: 175px;
            margin: 25px 45px;
          }
        }
      }
      .searchArea {
        float: right;
        margin-top: 35px;
        .searchForm {
          overflow: hidden;
          input {
            box-sizing: border-box;
            width: 490px;
            height: 32px;
            padding: 0px 4px;
            border: 2px solid #ea4a36;
            float: left;
            &:focus {
              outline: none;
            }
          }
          button {
            height: 32px;
            width: 68px;
            background-color: #ea4a36;
            border: none;
            color: #fff;
            float: left;
            cursor: pointer;
            &:focus {
              outline: none;
            }
          }
        }
      }
    }
  }
  .typeNav {
    border-bottom: 2px solid #e1251b;
    .container {
      width: 1200px;
      margin: 0 auto;
      display: flex;
      .all {
        width: 210px;
        height: 45px;
        background-color: #e1251b;
        line-height: 45px;
        text-align: center;
        color: #fff;
        font-size: 14px;
        font-weight: bold;
      }
      .nav {
        a {
          height: 45px;
          margin: 0 22px;
          line-height: 45px;
          font-size: 16px;
          color: #333;
        }
      }
    }
  }
  .footer {
    background-color: #eaeaea;
    .footer-container {
      width: 1200px;
      margin: 0 auto;
      padding: 0 15px;
      .footerList {
        padding: 20px;
        border-bottom: 1px solid #e4e1e1;
        border-top: 1px solid #e4e1e1;
        overflow: hidden;
        padding-left: 40px;
        .footerItem {
          width: 16.6666667%;
          float: left;
          h4 {
            font-size: 14px;
          }
          .footerItemCon {
            li {
              line-height: 18px;
            }
          }
          &:last-child img {
            width: 121px;
          }
        }
      }
      .copyright {
        padding: 20px;
        .helpLink {
          text-align: center;
          li {
            display: inline;
            .space {
              border-left: 1px solid #666;
              width: 1px;
              height: 13px;
              background: #666;
              margin: 8px 10px;
            }
          }
        }
        p {
          margin: 10px 0;
          text-align: center;
        }
      }
    }
  }
}
</style>
